Git Apprentice by By Chris Belanger
Author:By Chris Belanger
Language: eng
Format: epub
Publisher: Ray Wenderlich
Limiting results
This is straightforward; simply execute the following command to show the number of commits youâd like to see, starting from the most recent:
git log -3
Git will then show you just the three most recent commits. You can replace the 3 in the above example to show any number of commits youâd prefer.
Thatâs a little more manageable, but thereâs still a lot of detail in there. Wouldnât it be nice if there was a way to view just the commit messages and filter out all the other, extra information?
There is! Execute the following command to see a more compact view of the repository history:
git log --oneline
Youâll see a quick, compact view of the commit history, which is arguably far more readable than the original output from git log:
~/GitApprentice/ideas $ git log --oneline 477e542 (HEAD -> master) Adding .gitignore files and HTML ffcedc2 Adds all the good ideas about management 8409427 Removes terrible live streaming ideas 67fd0aa Moves platform ideas to website directory 0ddfac2 Updates book ideas for Symbian and MOS 6510 6c88142 Adding some tutorial ideas . . .
This also shows you the short hash of a commit. Although you havenât looked at hashes in depth yet, there are long and short hashes for each commit that uniquely identify a commit within a repository.
For instance, if I take a look at the first line of the most recent commit on my repo with git log -1 (thatâs the number â1â, not the letter âlâ), I see the following:
commit 477e542bfa35942ddf069d85fbe3fb0923cfab47 (HEAD -> master)
Now, to compare, I look at that same single commit with git log -1 --oneline (yes, you can stack multiple options with git log), I get the following:
477e542 (HEAD -> master) Adding .gitignore files and HTML
The short hash is simply the first seven characters of the long hash; in this case, 477e542. For the average-sized development project, seven hexadecimal digits provides you with more than a quarter of a billion short hashes, so the possibility of hashes colliding between various commits is quite small.
When you ramp up to massively-sized Git repositories that live on for years, or even decades, the chance of two commits having the same hash becomes a reality.
Older versions of Git allowed you to configure the number of hash characters to use for your repository, but more recent versions of Git (from about 2017 onward) dynamically adapt this setting to suit the size of your project, so you donât usually have to worry about it.
Note: Are you wondering why some options to commands are preceded with a single dash, while others are preceded with double dashes?
This has its roots way back in the history of command-line-based operating systems. Generally, commands that have double dashes are the âlong formâ of a command, and are there for clarity.
For instance, the command git log -p, which youâve used before, shows the diffs of your commits. But thereâs another command that only differs by the fact that the option is in uppercase: git log -P, which does something entirely different.
Since
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
What's Done in Darkness by Kayla Perrin(26619)
The Fifty Shades Trilogy & Grey by E L James(19100)
Shot Through the Heart: DI Grace Fisher 2 by Isabelle Grey(19081)
Shot Through the Heart by Mercy Celeste(18955)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 10 by Isuna Hasekura and Jyuu Ayakura(17139)
Python GUI Applications using PyQt5 : The hands-on guide to build apps with Python by Verdugo Leire(17026)
Peren F. Statistics for Business and Economics...Essential Formulas 3ed 2025 by Unknown(16898)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 03 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16840)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 01 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16470)
The Subtle Art of Not Giving a F*ck by Mark Manson(14384)
The 3rd Cycle of the Betrayed Series Collection: Extremely Controversial Historical Thrillers (Betrayed Series Boxed set) by McCray Carolyn(14158)
Stepbrother Stories 2 - 21 Taboo Story Collection (Brother Sister Stepbrother Stepsister Taboo Pseudo Incest Family Virgin Creampie Pregnant Forced Pregnancy Breeding) by Roxi Harding(13676)
Scorched Earth by Nick Kyme(12788)
Drei Generationen auf dem Jakobsweg by Stein Pia(10984)
Suna by Ziefle Pia(10903)
The Ultimate Python Exercise Book: 700 Practical Exercises for Beginners with Quiz Questions by Copy(10523)
D:\Jan\FTP\HOL\Work\Alien Breed - Tower Assault CD32 Alien Breed II - The Horror Continues Manual 1.jpg by PDFCreator(10487)
De Souza H. Master the Age of Artificial Intelligences. The Basic Guide...2024 by Unknown(10454)
Scythe by Neal Shusterman(10367)
